import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProdinfoVO, ProdinfoForm, ProdinfoQuery } from '@/api/basedata/prodinfo/types';

/**
 * 查询产品信息维护列表
 * @param query
 * @returns {*}
 */

export const listProdinfo = (query?: ProdinfoQuery): AxiosPromise<ProdinfoVO[]> => {
  return request({
    url: '/basedata/prodinfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询产品信息维护详细
 * @param id
 */
export const getProdinfo = (id: string | number): AxiosPromise<ProdinfoVO> => {
  return request({
    url: '/basedata/prodinfo/' + id,
    method: 'get'
  });
};

/**
 * 新增产品信息维护
 * @param data
 */
export const addProdinfo = (data: ProdinfoForm) => {
  return request({
    url: '/basedata/prodinfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改产品信息维护
 * @param data
 */
export const updateProdinfo = (data: ProdinfoForm) => {
  return request({
    url: '/basedata/prodinfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除产品信息维护
 * @param id
 */
export const delProdinfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basedata/prodinfo/' + id,
    method: 'delete'
  });
};
